package com.chinasofti.util;

import com.chinasofti.po.Data;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class GetFileClass {
    public static List<Data> readData() throws IOException {
        List<Data> datas =new ArrayList<>();
        //读取文件一行
        BufferedReader br=new BufferedReader(new FileReader("D:\\pxthadoop\\file\\class.txt"));
        String len=null;
        while ((len=br.readLine())!=null){
            Data data=new Data();
            String[]strs=len.split("\t");
            data.setName(strs[0]);
            data.setValue(strs[1]);
            datas.add(data);
        }
        return datas;
    }
    //测试
    public static void main(String[] args) throws IOException {
        List<Data> datas=GetFileClass.readData();
        for (Data data:datas){
            System.out.println(data);
        }
    }
}
